<div id="textbookListForm">
{if isset($textbooks)}
    <table>
        <thead>
            {if isset($authenticated)}<th>Kontakt</th>{/if}
            <th>ID</th>
	    <th>ISBN</th>
            <th>Naslov</th>
            <th>Avtorji</th>
            <th>Založnik</th>
            <th>Leto izdaje</th>
            <th>Cena</th>
            <th>Zamenjava</th>
	    {if array_key_exists('count', $textbooks[0])}
		<th>Sporočila</th>
	    {/if}
          </thead>
          <tbody>
              {foreach from=$textbooks item=textbook name=counter}
              <tr class="{if $smarty.foreach.counter.index % 2 == 0}evenRow{else}oddRow{/if}">
                  {if isset($authenticated)}<td><a class="getLink" href="?{$znf.moduleIndex}=textbook&amp;{$znf.actionIndex}=contact&amp;id={$textbook.id}&amp;pageID={$pageID}" title="Kontaktiraj ponudnika">Piši <img src="images/default/contact.png" alt="Kontaktiraj ponudnika" /></a></td>{/if}
		  <td>{$textbook.id}</td>
                  <td>{$textbook.isbn}</td>
                  <td>{$textbook.title}</td>
                  <td>{$textbook.authors}</td>
                  <td>{$textbook.publisher}</td>
                  <td>{$textbook.published}</td>
                  <td>{$textbook.price}</td>
                  <td>{if $textbook.forchange}<img src="images/default/ok.png" alt="Zamenjava učbenika" />{/if}</td>
		  {if isset($textbook.count)}
		      <td {if $textbook.count > 0}class="alreadyContacted"{/if}>{if $textbook.count > 0}{$textbook.count}{else}0{/if}</td>
		  {/if}
              </tr>

	      {if strlen($textbook.comment) > 0}
	          <tr class="{if $smarty.foreach.counter.index % 2 == 0}evenRow{else}oddRow{/if}">
	              <td>&nbsp;</td>
 		      <td colspan="{if isset($textbook.count)}9{else}8{/if}">{$textbook.comment}</td>
	          </tr>
              {/if}
              {/foreach}
         </tbody>
    </table>
    <div>
        <form id="hiddenForm" action="noAction" method="post">
	   <input type="hidden" id="isbn" name="isbn" value="{$isbn}" />
	   <input type="hidden" id="title" name="title" value="{$title}" />
	   <input type="hidden" id="authors" name="authors" value="{$authors}" />
	   <input type="hidden" id="publisher" name="publisher" value="{$publisher}" />
	</form>
    </div>
    <div id="pager">
        {$pager}
    </div>
{else}
    Noben učbenik ne zadošča iskalnim pogojem. {if isset($saved)}Sistem si je vsekakor zabeležil vašo zahtevo in vas bo - v obdobju naslednjih {$period} dni - nemudoma obvestil vsakič, ko bo nek uporabnik ponujal učbenik, ki ste ga iskali.{/if}
{/if}
</div>
